//
//  UIBarButtonItem+Extension.m
//  SinaWeiBo
//
//  Created by WGP on 16/4/13.
//  Copyright © 2016年 WGP. All rights reserved.
//

#import "UIBarButtonItem+Extension.h"

@implementation UIBarButtonItem (Extension)

+(instancetype)customViewWith:(NSString *)imageName target:(id)target action:(SEL)action
{
    UIButton *btn = [[UIButton alloc] init];
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
//    navigationbar_pop_highlighted
    NSString *highLightName = [NSString stringWithFormat:@"%@_selected",imageName];
    [btn setImage:[UIImage imageNamed:highLightName] forState:UIControlStateSelected];
    [btn sizeToFit];
    
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[self alloc] initWithCustomView:btn];
}

@end
